package com.ftwj.demo.generate.entity;

import java.io.Serializable;
import java.util.Arrays;
import java.util.List;

import com.ftwj.demo.generate.utils.ConfigUtil;
import com.ftwj.demo.generate.utils.StringUtil;

/**
*
* <p>Title: ColumnInfo</p>  
* <p>Description: 描述</p>
* <p>Copyright: Copyright (c) 2020 </p>  
* <p>Company: 兰州飞天网景信息产业有限公司</p>    
* @author WangSLi
* @date 2020年2月27日 下午1:52:40
* @version V1.0
 */
public class TableInfo implements Serializable {
	
    /** serialVersionUID*/ 
	private static final long serialVersionUID = 1L;
	
	private String[] perfix=ConfigUtil.getConfiguration().getPerfix();
	private String tableName; //表名
	private String className; //类名
	private String lowerClassName; //类名
	private Configuration config; //配置
	private List<ColumnInfo> columns;//列名

	public TableInfo(String tableName, List<ColumnInfo> columns) {
		this.tableName = tableName;
		this.className = StringUtil.tableName2ClassName(tableName,perfix);
		this.lowerClassName=StringUtil.firstToLowerCase(className);
		this.columns = columns;
		this.config=ConfigUtil.getConfiguration();
	}
	
	public String[] getPerfix() {
		return perfix;
	}

	public void setPerfix(String[] perfix) {
		this.perfix = perfix;
	}
	
	public String getTableName() {
		return tableName;
	}

	public void setTableName(String tableName) {
		this.tableName = tableName;
	}

	public String getClassName() {
		return className;
	}
	
	public void setClassName(String className) {
		this.className = className;
	}

	public String getLowerClassName() {
		return lowerClassName;
	}

	public Configuration getConfig() {
		return config;
	}

	public List<ColumnInfo> getColumns() {
		return columns;
	}

	public void setColumns(List<ColumnInfo> columns) {
		this.columns = columns;
	}

	@Override
	public String toString() {
		return "TableInfo [perfix=" + Arrays.toString(perfix) + ", tableName=" + tableName + ", className=" + className
				+ ", config=" + config + ", columns=" + columns + "]";
	}

}
